package com.hzhr.iot.statis.convertor;

import com.hzhr.iot.statis.convertor.custom.*;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.core.util.HzhrJsonUtil;
import java.util.Map;
import com.hzhr.iot.statis.model.deptDailyGasConsume.DeptDailyGasConsumeModel;
import com.hzhr.iot.statis.entity.DeptDailyGasConsumeEntity;
import com.hzhr.iot.statis.entity.ext.DeptDailyGasConsumeEntityExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hzhr.iot.statis.model.deptDailyGasConsume.DeptDailyGasConsumeModel;
import com.hzhr.iot.statis.model.deptDailyGasConsume.DeptDailyGasConsumeGetModel;
import com.hzhr.iot.statis.queryModel.custom.DeptDailyGasConsumeCustomQueryModel;

@Component
public class DeptDailyGasConsumeConvertor {
    @Autowired
    DeptMonthlyGasConsumeCustomConvertor deptMonthlyGasConsumeCustomConvertor;
    @Autowired
    DeviceCollectDeviceCustomConvertor deviceCollectDeviceCustomConvertor;
    @Autowired
    DeviceDailyGasConsumeCustomConvertor deviceDailyGasConsumeCustomConvertor;
    @Autowired
    DeviceDataExceptionCustomConvertor deviceDataExceptionCustomConvertor;
    @Autowired
    DeviceHourlyGasConsumeCustomConvertor deviceHourlyGasConsumeCustomConvertor;
    @Autowired
    DeviceIotDeviceCustomConvertor deviceIotDeviceCustomConvertor;
    @Autowired
    DeviceMonthlyGasConsumeCustomConvertor deviceMonthlyGasConsumeCustomConvertor;
    @Autowired
    GasUserDailyGasConsumeCustomConvertor gasUserDailyGasConsumeCustomConvertor;
    @Autowired
    GasUserMonthlyGasConsumeCustomConvertor gasUserMonthlyGasConsumeCustomConvertor;
    @Autowired
    OptionsCustomConvertor optionsCustomConvertor;

    public DeptDailyGasConsumeEntity deptDailyGasConsumeModel2entity(DeptDailyGasConsumeModel in) {
        //未转换字段: id 
        if (in == null) return null;
        DeptDailyGasConsumeEntity result = new DeptDailyGasConsumeEntity();

        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.long2date(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public DeptDailyGasConsumeEntity deptDailyGasConsumeModel2entity(DeptDailyGasConsumeModel in, DeptDailyGasConsumeEntity ori) {
        //未转换字段: id 
        if (in == null) return null;
        DeptDailyGasConsumeEntity result = ori;

        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.long2date(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<DeptDailyGasConsumeEntity> deptDailyGasConsumeModelList2entityList(List<DeptDailyGasConsumeModel> in) {
        if (in == null) return null;
        List<DeptDailyGasConsumeEntity> result = new ArrayList<>();
        for (DeptDailyGasConsumeModel item : in) {
            result.add(deptDailyGasConsumeModel2entity(item));
        }
        return result;
    }
    public DeptDailyGasConsumeModel entity2deptDailyGasConsumeModel(DeptDailyGasConsumeEntity in) {
        //未转换字段: 
        if (in == null) return null;
        DeptDailyGasConsumeModel result = new DeptDailyGasConsumeModel();

        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.date2long(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<DeptDailyGasConsumeModel> entityList2deptDailyGasConsumeModelList(List<DeptDailyGasConsumeEntity> in) {
        if (in == null) return null;
        List<DeptDailyGasConsumeModel> result = new ArrayList<>();
        for (DeptDailyGasConsumeEntity item : in) {
            result.add(entity2deptDailyGasConsumeModel(item));
        }
        return result;
    }
    public DeptDailyGasConsumeModel ext2deptDailyGasConsumeModel(DeptDailyGasConsumeEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        DeptDailyGasConsumeModel result = new DeptDailyGasConsumeModel();

        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.date2long(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<DeptDailyGasConsumeModel> extList2deptDailyGasConsumeModelList(List<DeptDailyGasConsumeEntityExt> in) {
        if (in == null) return null;
        List<DeptDailyGasConsumeModel> result = new ArrayList<>();
        for (DeptDailyGasConsumeEntityExt item : in) {
            result.add(ext2deptDailyGasConsumeModel(item));
        }
        return result;
    }
    public DeptDailyGasConsumeGetModel extList2deptDailyGasConsumeGetModel(List<DeptDailyGasConsumeEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeptDailyGasConsumeModel> modelList = extList2deptDailyGasConsumeModelList(extList);
        if (modelList == null) {
            DeptDailyGasConsumeGetModel result = new DeptDailyGasConsumeGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));


        DeptDailyGasConsumeGetModel result = new DeptDailyGasConsumeGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public DeptDailyGasConsumeGetModel entity2deptDailyGasConsumeGetModel(DeptDailyGasConsumeEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeptDailyGasConsumeEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2deptDailyGasConsumeGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, DeptDailyGasConsumeEntityExt.class));
        return extList2deptDailyGasConsumeGetModel(extList, total, changeCount, query);
     }
    public DeptDailyGasConsumeCustomQueryModel deptDailyGasConsumeService_query2queryModel(Map<String, Object> query) {
        DeptDailyGasConsumeCustomQueryModel queryModel = new DeptDailyGasConsumeCustomQueryModel();

        Integer _equal_deptId = HzhrTypeUtil.object2integer(query.get("_equal_deptId"));
        if (_equal_deptId != null) {
            queryModel.setEqual_deptId(_equal_deptId);
         }

        Integer _equal_companyId = HzhrTypeUtil.object2integer(query.get("_equal_companyId"));
        if (_equal_companyId != null) {
            queryModel.setEqual_companyId(_equal_companyId);
         }

        String _equal_gasUserType = HzhrTypeUtil.object2string(query.get("_equal_gasUserType"));
        if (_equal_gasUserType != null) {
            queryModel.setEqual_gasUserType(_equal_gasUserType);
         }

        Date _greaterthan_date = HzhrTypeUtil.object2date(query.get("_greaterthan_date"));
        if (_greaterthan_date != null) {
            queryModel.setGreaterthan_date(_greaterthan_date);
         }

        Date _greaterthanorequal_date = HzhrTypeUtil.object2date(query.get("_greaterthanorequal_date"));
        if (_greaterthanorequal_date != null) {
            queryModel.setGreaterthanorequal_date(_greaterthanorequal_date);
         }

        Date _lessthan_date = HzhrTypeUtil.object2date(query.get("_lessthan_date"));
        if (_lessthan_date != null) {
            queryModel.setLessthan_date(_lessthan_date);
         }

        Date _lessthanorequal_date = HzhrTypeUtil.object2date(query.get("_lessthanorequal_date"));
        if (_lessthanorequal_date != null) {
            queryModel.setLessthanorequal_date(_lessthanorequal_date);
         }

        String _orderBy_date = HzhrTypeUtil.object2string(query.get("_orderBy_date"));
        if (_orderBy_date != null) {
            queryModel.setOrderBy_date(_orderBy_date);
         }

        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }

}

